{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Usage: [*]Usage:./unzip.py -f <zipfile>-d<dictionary>\n",
      "\n",
      "ipykernel_launcher.py: error: no such option: -f\n"
     ]
    },
    {
     "ename": "SystemExit",
     "evalue": "2",
     "output_type": "error",
     "traceback": [
      "An exception has occurred, use %tb to see the full traceback.\n",
      "\u001b[1;31mSystemExit\u001b[0m\u001b[1;31m:\u001b[0m 2\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\anaconda3\\lib\\site-packages\\IPython\\core\\interactiveshell.py:3275: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.\n",
      "  warn(\"To exit: use 'exit', 'quit', or Ctrl-D.\", stacklevel=1)\n"
     ]
    }
   ],
   "source": [
    "import zipfile,optparse\n",
    "from threading import Thread\n",
    "def extractFile(zFile,password):\n",
    "    try:\n",
    "        zFile.extractall(pwd=password.encode('ascii'))\n",
    "        print('[+] Found Password:' +password+'\\n')\n",
    "    except Exception as e:\n",
    "        print(e)\n",
    "def main():\n",
    "    parser=optparse.OptionParser(\"[*]Usage:./unzip.py -f <zipfile>-d<dictionary>\")\n",
    "    #parser.add_option('-f',dest='znam',trpe='string',help='specify zip file')\n",
    "    #parser.add_option('-d',dest='dnam',trpe='string',help='specify dictionary')\n",
    "    (options,args)=parser.parse_args()\n",
    "    if (options.zname==None)|(options.dname==None):\n",
    "        print(parser.usage)\n",
    "        exit(0)\n",
    "    zFile=zipfile.ZipFile(options.zname)\n",
    "    passFile=open(options.dname)\n",
    "    for line in passFile:\n",
    "        line=line.strip('\\n')\n",
    "        t=Thread(target=extractFile,args=(zFile,line))\n",
    "        t.start()\n",
    "if __name__=='__main__':\n",
    "    main()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
